function isLogin(){
	$.post("/CuitShopPlatform/servlet/isLoginController",{"action":"isLogin"}, function(data){
		if(data.loginflag=='0')
			return;
		$(".rightTopBar").empty();
		var node="<a href='user.html' class='userMsg' id="+data.userid+">"+"欢迎-"+data.username+"</a>";
		$(node).appendTo(".rightTopBar");
	},"json");
};

function getIndexMsg(){
	$.post("/CuitShopPlatform/servlet/GetIndexMsg",{"action":"getIndexMader"},function(data){
		for(var i in data){
			var node='<div class="col-md-3 column"><a href="#"><div class="name">'+data[i].name+'</div>'
			+'<div class="price">'+data[i].des+'</div>'
			+'<img src="'+data[i].imgsrc+'" alt=""></a></div>';
			$(node).appendTo("#mader");
		}
	},"json");
	
	$.post("/CuitShopPlatform/servlet/GetIndexMsg",{"action":"getIndexItem1"},function(data){
		for(var i in data){
			var node='<div class="col-md-3 column"><a href="detail.html?itemId='+data[i].id+'">'
			  +'<img src="'+data[i].picture+'"></a>'
	          +'<div class="bd"><div class="name">'+data[i].name+'</div>'
	          +'<div class="price">'+data[i].price+'</div>'
	          +'<div class="desp">'+data[i].information+'</div></div></div>';
			$(node).appendTo("#jujia");
		}
	},"json");
	
	$.post("/CuitShopPlatform/servlet/GetIndexMsg",{"action":"getIndexItem2"},function(data){
		for(var i in data){
			var node='<div class="col-md-3 column"><a href="detail.html?itemId='+data[i].id+'">'
			  +'<img src="'+data[i].picture+'"></a>'
	          +'<div class="bd"><div class="name">'+data[i].name+'</div>'
	          +'<div class="price">'+data[i].price+'</div>'
	          +'<div class="desp">'+data[i].information+'</div></div></div>';
			$(node).appendTo("#chuangping");
		}
	},"json");

};


$(function(){
	isLogin();
	getIndexMsg();
})